<template>
  <div :class="['plan', 'create-cp', isFinishedPlanShow?'create-cp__finish':'']">
    <div class="create-cp-li con">
      <div class="lab">{{$t('customer.contactPlan.contactPlanContent')}}</div>
      <p class="deal">{{ planContent }}</p>
    </div>
    <div class="create-cp-li fini">
      <div class="lab">{{$t('customer.contactPlan.contactPlanTime')}}</div>
      <p>{{ planTime }}</p>
    </div>
    <div class="create-cp-li con">
      <div class="lab">&nbsp;&nbsp;{{$t('customer.contactPlan.excute')}}</div>
      <p>{{ currExecutor }}</p>
    </div>
    <div class="btn-box">
      <el-button type="cancel" @click.stop="cancelDeal" class="primary_btn">{{ $t('public.cancel') }}</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'FinishedContactPlan',
  props: {
    executorNew: String,
    planTime: String,
    planContent: String,
    isFinishedPlanShow: Boolean
  },
  data () {
    return {
      agentObj: {}
    }
  },
  computed: {
    currExecutor () {
      if (this.executorNew) {
        return this.agentObj[this.executorNew] ? this.agentObj[this.executorNew].displayName || this.agentObj[this.executorNew].exten : ''
      } else {
        return ''
      }
    }
  },
  created () {
    this.agentObj = {}
    let _arr = this.$getCache('agents')
    for (let i = 0; i < _arr.length; i++) {
      this.agentObj[_arr[i]._id] = _arr[i]
    }
  },
  methods: {
    cancelDeal () {
      this.$emit('cancel')
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '../../../../assets/common.styl'
.con,.fini
  p
    display inline-block
    font-size 12px
    color $cf-gray0
    margin 0 0 0 28px
    vertical-align top
    width calc(100% - 78px)
    word-break break-all
  span
    color $c-main
    width 120px
    text-align right
    font-size 12px
    cursor pointer
.btn-box
  margin-top 10px
  text-align right
  .primary_btn
    display inline-block
.lab
  display inline-block
  color #595959
.create-cp-li+.create-cp-li
  margin-top 10px
</style>
